package heman.server.controllerchain;


import heman.server.controllers.LoginController;
import heman.server.controllers.LogoutController;
import ks.framework.common.Message;
import ks.framework.communicator.Communicator;
import ks.server.controllers.ServerControllerChain;

/**
 * This class defines the chain of controllers that I will provide for you. As this
 * list grows (if at all) I will alert the class.
 * 
 * @author George Heineman
 */
public class DefaultServerChain extends ServerControllerChain {
	
	/**
	 * Default controllers are:
	 * 
	 * {@link LoginController}
	 * {@link LogoutController}
	 */
	@Override
	public boolean process(Communicator com, Message m) {
		
		
		if (m.getName().equals ("login")) {
			return new LoginController().process(com, m);
		}
		
		if (m.getName().equals ("logout")) {
			return new LogoutController().process(com, m);
		}
		
		// try the next one
		return next(com, m);
	}

	
}
